{php include pubTemplate("header")}
<div class="container">


    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="{SITE_URL}">首页</a></li>
            <li class="breadcrumb-item"><a href="{tsUrl('group')}">{$TS_APP['appname']}</a></li>
            <li class="breadcrumb-item active" aria-current="page">{$strGroup['groupname']}</li>
        </ol>
    </nav>







    <div class="card">



        <div class="group_show">



            <div class="row">

                <div class="col-md-8">



                    <div class="media">
                        <img class="mr-3 rounded" src="{$strGroup['photo']}" alt="{$strGroup['groupname']}" width="70">
                        <div class="media-body">
                            <h1 class="mt-0 fw400 fs18 text-light">{$strGroup['groupname']}</h1>
                            <div class="fs12 text-light fw300">

                                <span class="mr-2">{$strGroup['count_topic']} 帖子</span>
                                <span>{$strGroup['count_user']} 成员</span>

                            </div>

                            <div class="fs12 text-light fw300 mt-1">

                                <span class="mr-2">创建于 {php echo date('Y-m-d',$strGroup[addtime])}</span>

                                组长：<a class="mr-2 text-light" href="{tsUrl('user','space',array('id'=>$strLeader['userid']))}"  rel="face" uid="{$strLeader['userid']}">{$strLeader['username']}</a>
                                {if $arrGroupAdminUser}
                                管理员：
                                {loop $arrGroupAdminUser $key $item}
                                <a class="mr-2 text-light" href="{tsUrl('user','space',array('id'=>$item['userid']))}">{$item['username']}</a>
                                {/loop}
                                {/if}
                            </div>

                        </div>
                    </div>



                </div>
                <div class="col-md-4">



                    <div class="join">
                        {if $isGroupUser > 0 && $TS_USER['userid'] != $strGroup['userid']}
                        <span>我是这个小组的{$strGroup['role_user']} <a href="javascript:void('0')" onclick="exitGroup('{$strGroup['groupid']}')">退出小组</a></span>
                        {elseif $isGroupUser > 0 && $TS_USER['userid'] == $strGroup['userid']}
                        <span>我是这个小组的{$strGroup['role_leader']}</span>
                        {elseif $strGroup['joinway'] == '0'}
                        <span><a class="btn btn-success btn-sm" href="javascript:void('0');" onclick="joinGroup('{$strGroup['groupid']}');">加入小组</a></span>
                        {elseif $strGroup['joinway'] == '2'}
                        <span><a class="btn btn-success btn-sm" href="javascript:void('0')" onclick="joinGroup('{$strGroup['groupid']}')">申请加入小组</a></span>

                        {elseif $strGroup['joinway']==3}

                        <span><a class="btn btn-success btn-sm" href="javascript:void('0')" onclick="joinGroup('{$strGroup['groupid']}')">需要支付<font color="orange" style="font-size: 16px;">{$strGroup['price']}金币</font>加入小组</a></span>

                        {else}
                        <span>本小组禁止加入</span>
                        {/if}
                    </div>



                </div>

            </div>


        </div>




        <div class="card-body">

            <div class="text-black-50">{php echo nl2br($strGroup['groupdesc'])}</div>

            {if $strGroup ['tags']}
            <div class="mt-2">
                {loop $strGroup['tags'] $key $item}
                <a class="badge badge-secondary mr-2 fw300" href="{tsUrl('group','tag',array('id'=>urlencode($item['tagname'])))}">{$item['tagname']}</a>
                {/loop}
            </div>
            {/if}

        </div>
    </div>






    <div class="row">

<div class="col-md-8">




    {if $strGroup['isopen']==1 && $isGroupUser==''}

    <div class="alert alert-info">你需要加入小组后才可以访问帖子内容</div>

    {elseif $strGroup['isopen']==1 && $isGroupUser && $TS_APP['ispayjoin']==1 && $isGroupUser['endtime']!='0000-00-00' && $isGroupUser['endtime']!='1970-01-01' && $isGroupUser['endtime']<date('Y-m-d')}
    <div class="alert alert-info">你的组费已经到期，请联系组长续期！续期后才可以访问帖子内容。</div>
    {else}

    <div class="card" >
        <div class="card-body" style="position: relative;">


            <div style="position: absolute;right: 20px;top: 20px;"><a class="btn btn-info btn-sm" href="{tsUrl('topic','add',array('groupid'=>$strGroup['groupid']))}">发布帖子</a></div>


            <div class="mb-3">
                <a class="btn btn-sm {if $typeid==0}btn-outline-secondary{else}text-secondary{/if}" href="{tsUrl('group','show',array('id'=>$strGroup['groupid']))}">全部</a>
                {loop $arrTopicType $key $item}
                <a class="btn btn-sm {if $typeid==$item['typeid']}btn-outline-secondary{else}text-secondary{/if}" href="{tsUrl('group','show',array('id'=>$strGroup['groupid'],typeid=>$item['typeid']))}">{$item['typename']}</a>
                {/loop}
            </div>


            <hr />






<div class="topic_list">
<ul>

{loop $arrTopic $key $item}
<li>
<div class="userimg">
<a href="{tsUrl('user','space',array('id'=>$item['user']['userid']))}">
    <img class="rounded-circle" src="{$item['user']['face']}" width="32" height="32" alt="{$item['user']['username']}" title="{$item['user']['username']}" />
</a>
</div>

<div class="topic_title">
<div class="title">

{if $item['label']}<span class="badge badge-danger fw300">{tsTitle($item['label'])}</span>{/if}

{if $item['typeid'] != 0}<a href="{tsUrl('group','show',array('id'=>$item['groupid'],typeid=>$item['typeid']))}">[{$item['typename']}]</a>{/if}


<a href="{tsUrl('topic','show',array('id'=>$item['topicid']))}">{$item['title']}</a>


{if $item['istop']=='1'}
<img src="{SITE_URL}public/images/ding.png" width="24" height="24" title="[置顶]" alt="[置顶]" />
{/if} 

{if $item['isposts'] == '1'}
<img src="{SITE_URL}public/images/posts.gif" title="[精华]" alt="[精华]" />
{/if}


</div>


    {if $item['group']['isopen']==0 && $item['score']==0 && $item['iscommentshow']==0}
    <div class="gaiyao mt-2 c9">
        {$item['gaiyao']}
    </div>
    {if $item['photos']}
    <div class="photo mt-2">
        {loop $item['photos'] $pkey $pitem}
        <a href="{tsUrl('topic','show',array('id'=>$item['topicid']))}"><img src="{$pitem}" /></a>
        {/loop}
    </div>
    {/if}
    {/if}


    <div class="d-flex flex-row justify-content-between mt-2">
        <div class="d-flex fs12 c9">
            <a href="{tsUrl('user','space',array('id'=>$item['userid']))}">{$item['user']['username']}</a>
            <span class="ml-1">发表于</span>
            <span class="ml-1">{php echo getTime($item['uptime'],time())}</span>
        </div>
        <div class="d-flex c9 fs12">
            <div><i class="far fa-comment-dots"></i> {$item['count_comment']}</div>
            <div class="ml-3"><i class="far fa-eye"></i> {$item['count_view']}</div>
        </div>
    </div>



</div>
<div class="clear"></div>
</li>	
{/loop}

</ul>
</div>


<div class="mt-3">{$pageUrl}</div>


</div>


</div>

    {/if}



</div>


<div class="col-md-4">


    <div class="card">
        <div class="card-header">成员 <small class="float-right"><a class="text-black-50" href="{tsUrl('group','user',array('id'=>$strGroup['groupid']))}">更多</a></small></div>
        <div class="card-body">



            <div class="row">
                {loop $arrGroupUser $key $item}
                <div class="col-3 text-light mb-3">
                    <a href="{tsUrl('user','space',array('id'=>$item['userid']))}"><img class="rounded-circle" src="{$item['face']}" width="48" height="48" alt="{$item['username']}" title="{$item['username']}" /></a>
                    <div class="title-cut fs12 text-black-50 mt-1 text-center"><a href="{tsUrl('user','space',array('id'=>$item['userid']))}">{$item['username']}</a></div>
                </div>
                {/loop}
            </div>


</div>
</div>




    {if $TS_USER['userid'] == $strGroup['userid'] || $TS_USER['isadmin']=='1'}
    <div class="card">
    <div class="card-header">管理</div>
    <div class="card-body">
        <a class="btn btn-sm btn-outline-info" href="{tsUrl('group','edit',array('groupid'=>$strGroup['groupid'],'ts'=>'base'))}">小组设置</a>
        <a class="btn btn-sm btn-outline-info" href="{tsUrl('group','audit',array('groupid'=>$strGroup['groupid']))}">帖子审核({$strGroup['count_topic_audit']})</a>
    </div>
    </div>
    {/if}

<div class="clear"></div>
<!--广告位-->
{php doAction('gobad','300')}


</div>
</div>
</div>

{php include pubTemplate("footer")}